package org.ediba.siri.core.request.service;

import java.io.InputStream;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.ediba.siri.core.Filter;
import org.ediba.siri.core.request.domain.Request;
import org.ediba.siri.core.request.domain.RequestAngle;
import org.ediba.siri.core.request.domain.RequestAttachment;
import org.ediba.siri.core.request.domain.RequestModel;
import org.ediba.siri.core.request.domain.RequestTake;
import org.ediba.siri.core.request.domain.RequestUsage;

public interface RequestService {
	
	/* Request CRUD */
	abstract Request create();
	abstract Request retrieve(int id);
	abstract Request update(Request request);
	abstract boolean delete(int id);
	
	abstract List<Request> retrieve(Map<Filter, Collection<Object>> filters,String sort,boolean dir,int start, int limit);
	abstract int retrieveCount(Map<Filter, Collection<Object>> filters);
	abstract List<Request> retrieve(Filter filter, Object value, String sort, boolean dir, Integer start, Integer limit);
	abstract int retrieveCount(Filter filter, Object value);
	
	abstract int copy(int id) throws IllegalArgumentException;
	abstract int send(int id) throws IllegalArgumentException;
	abstract void setPending(int id, boolean pending) throws IllegalArgumentException;
	
	/* RequestAngle CRUD */
	abstract RequestAngle angleCreate(String name, boolean message);
	abstract RequestAngle angleRetrieve(int id);
	abstract RequestAngle angleUpdate(RequestAngle requestAngle);
	abstract boolean angleDelete(int id);
	
	abstract List<RequestAngle> angleRetrieve();

	/* RequestAttachment CRUD */
	abstract RequestAttachment attachmentCreate(int idRequest, String name, InputStream inputStream);
	abstract RequestAttachment attachmentRetrieve(int idRequest, int id);
	abstract InputStream attachmentRetrieveStream(int idRequest, int id);
	abstract boolean attachmentDelete(int idRequest, int id);
	
	abstract List<RequestAttachment> attachmentRetrieve(int idRequest);
	
	/* RequestModel CRUD */
	abstract RequestModel modelCreate(int idRequest);
	abstract RequestModel modelRetrieve(int id);
	abstract RequestModel modelUpdate(RequestModel requestModel);
	abstract boolean modelDelete(int id);
	
	abstract List<RequestModel> modelRetrieve();

	/* RequestTake CRUD */
	abstract RequestTake takeCreate(String name, boolean message);
	abstract RequestTake takeRetrieve(int id);
	abstract RequestTake takeUpdate(RequestTake requestTake);
	abstract boolean takeDelete(int id);
	
	abstract List<RequestTake> takeRetrieve();
	
	/* RequestUsage CRUD */
	abstract RequestUsage usageCreate(String name, boolean message);
	abstract RequestUsage usageRetrieve(int id);
	abstract RequestUsage usageUpdate(RequestUsage requestUsage);
	abstract boolean usageDelete(int id);
	
	abstract List<RequestUsage> usageRetrieve();

}